/*
 * Useful functions in dbDir
 */

package org.dbdir.core;

import org.dbdir.core.helper.ACL;

/**
 *
 * @author thotheolh
 */
public class Functions {

    public Functions(){

    }

    public boolean isAdminACLOk(ACL acl) {
        boolean ok = true;
        if (acl.isShowDbPath() == false) {
            ok = false;
        }
        if (acl.isShowDbUsername() == false) {
            ok = false;
        }
        if (acl.isShowDbPassword() == false) {
            ok = false;
        }
        if (acl.isShowDateTimeReg() == false) {
            ok = false;
        }
        if (acl.isEditDbPath() == false) {
            ok = false;
        }
        if (acl.isEditDbUsername() == false) {
            ok = false;
        }
        if (acl.isEditDbPassword() == false) {
            ok = false;
        }
        return ok;
    }

    public ACL correctAdminACL(ACL acl) {
        if (acl.isShowDbPath() == false) {
            acl.setShowDbPath(true);
        }
        if (acl.isShowDbUsername() == false) {
            acl.setShowDbUsername(true);
        }
        if (acl.isShowDbPassword() == false) {
            acl.setShowDbPassword(true);
        }
        if (acl.isShowDateTimeReg() == false) {
            acl.setShowDateTimeReg(true);
        }
        if (acl.isEditDbPath() == false) {
            acl.setEditDbPath(true);
        }
        if (acl.isEditDbUsername() == false) {
            acl.setEditDbUsername(true);
        }
        if (acl.isEditDbPassword() == false) {
            acl.setEditDbPassword(true);
        }
        return acl;
    }

}
